#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>


int main()
{
	int     N_c = 0;
	typedef float Real;
	Real i, x=0, L=21, L_c, sigma_c=2.5, ix=0;
	FILE *fichier = NULL;
	
	N_c = floor( L / sigma_c );	
	printf("%d \n",N_c);
	
	L_c = L / N_c;
	printf("%g %g %g\n",L_c, L, L_c * N_c);
	
	fichier = fopen("cell.txt","wb");
	if(fichier)
	{
		fclose(fichier);
	}
	
	
	for(i=(-L); i<(L); i+=0.01)
	{	
		x = i;
		
		while(x > L/2)
		{
			x -= L;
			printf("%g\n",x);
		}
		while(x < -L/2)
		{
			x += L;
		}  
		
		ix = floor((x+(L/2))/L_c);
		
		printf("i:%g  x:%g  ix:%g\n",i,x,ix);
		
		fichier = fopen("cell.txt","ab");
		if(fichier)
		{
			fprintf(fichier,"%g %g \n",x,ix);
			fclose(fichier);
		}
		
	}
	printf("pour -L/2: %g\n",floor((-L/2+L/2)/L_c));
	printf("pour +L/2: %g\n",floor((L/2+L/2)/L_c));
	printf( "N_c=%d\n", N_c);
	return 0;
}
